package com.palace.saw.module.app.dal.mysql.configtype;

import com.palace.saw.framework.common.pojo.PageResult;
import com.palace.saw.framework.mybatis.core.mapper.BaseMapperX;
import com.palace.saw.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.palace.saw.module.app.controller.admin.configtype.vo.ConfigTypePageReqVO;
import com.palace.saw.module.app.dal.dataobject.configtype.ConfigTypeDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 配置类型 Mapper
 *
 * @author saw
 */
@Mapper
public interface ConfigTypeMapper extends BaseMapperX<ConfigTypeDO> {

    default PageResult<ConfigTypeDO> selectPage(ConfigTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ConfigTypeDO>()
                .likeIfPresent(ConfigTypeDO::getName, reqVO.getName())
                .eqIfPresent(ConfigTypeDO::getType, reqVO.getType())
                .eqIfPresent(ConfigTypeDO::getStatus, reqVO.getStatus())
                .eqIfPresent(ConfigTypeDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(ConfigTypeDO::getCreateTime, reqVO.getCreateTime())
                .betweenIfPresent(ConfigTypeDO::getDeletedTime, reqVO.getDeletedTime())
                .orderByDesc(ConfigTypeDO::getId));
    }

}